/**
 * @author wos
 * title:用于设定全局下 global下的设定
 * @type {path.PlatformPath | path}
 */
const path = require('path'),
      colors = require('colors-console'),
      getUser = require(path.join(__dirname,'../getUser'))
function main(){
    //全局数据库连接池
    global.query = require(path.join(__dirname,'../query/mysql'))
    //全局配置
    global.config = require(path.join(__dirname,'../../../config'))
    //全局返回
    global.response = require(path.join(__dirname,'../../utils/response'))
    //颜色包装
    global.colors = colors
    //获取用户信息
    global.getUser = getUser
    //全局返回用户的错误
    global.serverError = (ctx, msg='内部服务器错误') => {
        global.response(ctx,{
            "status":500,
            "code": 500,
            "data": {},
            "msg":msg
        })
    }
    //全局返回重新登陆
    global.goLogin = (ctx, msg='登陆超时，请重新登陆') => {
        global.response(ctx,{
            "status":200,
            "code": 444,
            "data": {},
            "msg":msg
        })
    }
}
module.exports = main
